function [Xc,Xs,settings] = create_training2(settings)
% create training set (Xc and Xs)

if settings.verbose, fprintf('creating training set\n'); end

S = load(settings.stego,'names');
C = load(settings.cover,'names');
[Sn,Sx] = sort(S.names); clear S
[Cn,Cx] = sort(C.names); clear C
names = intersect(Cn,Sn);
Ckeep = ismember(Cn,names); clear Cn
Skeep = ismember(Sn,names); clear Sn

% create training and testing parts
rand('state',settings.seed_trntst);
names_rnd = names(randperm(length(names)));
trn_names = names_rnd(1:length(names));
TRN_ID = ismember(names,trn_names);
clear trn_names names_rnd

% create training part from C
C = load(settings.cover,'F');
C = C.F(Cx,:);
C = C(Ckeep,:); clear Ckeep Cx
C(~TRN_ID,:) = []; Xc = C; clear C

% create training part from S
S = load(settings.stego,'F');
S = S.F(Sx,:); S = S(Skeep,:); clear Skeep Sx
S(~TRN_ID,:) = []; Xs = S; clear S
settings.max_dim = size(Xs,2);
